package wht.jly.forum.utils.validatecode.config;

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import wht.jly.forum.utils.validatecode.image.ImageValidateCodeGenerator;
import wht.jly.forum.utils.validatecode.properties.ImageValidateCodeProperties;

/**
 * 核心模块的配置类
 * <p>
 * - @EnableConfigurationProperties(SecurityProperties.class)
 * 使得自动配置生效
 *
 * @author lanyangji
 * @date 2019/2/18 15:35
 */
@Configuration
@EnableConfigurationProperties(ImageValidateCodeProperties.class)
public class ImageValidateCodeConfig {

    /**
     * 注入 图形验证码生成器
     *
     * @return
     */
    @Bean
    public ImageValidateCodeGenerator imageValidateCodeGenerator(ImageValidateCodeProperties imageValidateCodeProperties) {
        return new ImageValidateCodeGenerator(imageValidateCodeProperties);
    }

}
